﻿package model.drawPanel.entitys;
import java.awt.Polygon;
import java.util.ArrayList;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Display;


public class Pen extends Entity {

  /*
   * 
   */
private static final long serialVersionUID = 101250101L;
	private ArrayList<Integer> points;

	public Pen(){
		super(0, null, 0, 0, 0, 0, 0, 0);
	}
	public Pen(int id, Color color, int width, int x1, int y1, int x2,
			int y2) {
		super(id, color, width, -1, x1, y1, x2, y2);
		points = new ArrayList<Integer>();
		// TODO Auto-generated constructor stub
	}
	@Override
	 public void changeDrawing(int x, int y){//传递一直不断变化的第二点信息回来
		  points.add(x);
		  points.add(y);
	  }
  public void draw(Display display,GC gc) {
		if(color ==null){
			super.initeColor();
		}
	gc.setForeground(this.color);
	gc.setLineWidth(width);
	gc.setLineCap(SWT.CAP_ROUND);
	for(int i = 0; i<=(points.size()-4);i = i+2){
		gc.drawLine(points.get(i), points.get(i+1),points.get(i+2),points.get(i+3));
	}
  }
@Override
public String isFocused(int x, int y) {
	return "noEnter";
}

@Override 
public void move(int x,int y){
	
}
}